/*
 * @Author: taoyuqing
 * @Date: 2023-03-07 01:41:21
 * @Description: 
 */
import 'dart:collection';

import 'package:provider/provider.dart';
import 'package:flutter/material.dart';

class UserModel with ChangeNotifier {
  ///这个 model 只管理一个变量。
  String nickname = '';
  String userId = '';
  String email = '';
  String vipLevel = '';
  String avatar = '';
  String accountAmount = '';
  String accessToken = '';

  ///操作变量
  void setUserInfo(
      {String? name,
      String? id,
      String? mail,
      String? level,
      String? imgUrl,
      String? token,
      String? amount}) {
    nickname = name ?? '';
    userId = id ?? '';
    email = mail ?? '';
    vipLevel = level ?? '';
    avatar = imgUrl ?? '';
    accountAmount = amount ?? '';
    accessToken = token ?? '';
    notifyListeners();
  }

  ///操作变量
  void setUserName(String name) {
    nickname = name;
    notifyListeners();
  }
}
